package com.hebo.testdemo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hebo.testdemo.model.TFiles;
import com.hebo.testdemo.mapper.TFilesMapper;
import com.hebo.testdemo.service.ITFilesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.bytebuddy.implementation.bytecode.Throw;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.security.PublicKey;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author test
 * @since 2021-08-06
 */
@Service
public class TFilesServiceImpl extends ServiceImpl<TFilesMapper, TFiles> implements ITFilesService {

    @Resource
    private TFilesMapper tFilesMapper;


    @Override
    public List<TFiles> findAllByUserId(Integer id) {
        List<TFiles> tFiles = tFilesMapper.selectList(new LambdaQueryWrapper<TFiles>().eq(TFiles::getUserId, id));
//        List<TFiles> tFiles = this.list(lambdaQuery().eq(TFiles::getUserId, id));
        if (tFiles != null && tFiles.size() > 0) {
            return tFiles;
        } else {
            return null;
        }
    }

    @Override
    public void saveFile(TFiles tFiles) {
        boolean save = this.save(tFiles);
    }


}
